package com.raft.core.log.entry;

import java.util.Set;

import com.raft.core.node.NodeEndpoint;

/**添加节点和移除节点日志的抽象父类
 * <br/>集群的配置日志是旧配置(nodeEndpoints)加上操作的内容(newNodeEndpoint/nodeToRemove)
 * @author Ziroom
 *
 */
public abstract class GroupConfigEntry extends AbstractEntry {

    /**
     * 操作前配置
     */
    private final Set<NodeEndpoint> nodeEndpoints;

    protected GroupConfigEntry(int kind, int index, int term, Set<NodeEndpoint> nodeEndpoints) {
        super(kind, index, term);
        this.nodeEndpoints = nodeEndpoints;
    }

    /**获取操作前配置
     * @return
     */
    public Set<NodeEndpoint> getNodeEndpoints() {
        return nodeEndpoints;
    }

    /**获取最新结果配置
     * @return
     */
    public abstract Set<NodeEndpoint> getResultNodeEndpoints();

}
